//
// Created by wangwanlong on 2024/11/1.
//

#ifndef MKAHYPAR_MATH_H
#define MKAHYPAR_MATH_H

namespace mkahypar{
  namespace math{
    template <typename T>
    static inline T cs2(const T& x) {
      return x * x;
    }

    template <typename T>
    static inline T hash(const T& x) {
      return cs2(x);
    }
    //计算a^b
    template <typename T>
    static inline T pow(T a, T b) {
      T res = 1;
      while (b > 0) {
        if (b & 1) res = res * a;
        a = a * a;
        b >>= 1;
      }
      return res;
    }
  }
}
#endif //MKAHYPAR_MATH_H
